Putting a line break in an resx resource file

I had a Label control that I wanted to populate from a resource file, like so:

 <asp:Label ID="lblNote" runat="server" Text="<%$ Resources:AppInfo, Note%>" />

I needed to put a line break in the middle of the text.  To do that, I wanted to put a “<br>” in the text, but since the resource file complained when I tried to put greater than and less than symbols, I had to be sly about it. So in the AppInfo.resx file, I had this entry to add a line break:

   <data name="Note" xml:space="preserve">
    <value>Note: I want this to be the first line and &lt;br&gt;this to be the second.</value>
  </data>
  1. #1 by Syed Salman Sattar Shah on November 30, 2020 - 9:09 am

    Please use @HTML.Raw(—Your Resource Name—)

    • #2 by Shashank on April 4, 2023 - 7:01 pm

      This worked!

Leave a comment